package malitech.yadam.gui.acquire;

import malitech.yadam.model.acquire.JobParameters;
import malitech.yadam.model.acquire.JobStepParameters;

import com.trolltech.qt.gui.QDialog;
import com.trolltech.qt.gui.QWidget;

public class CreateJobDialog extends QDialog
{
   // private static final String juiResourceName = "classpath:malitech/iman/gui/acquire/CreateJobDialog.jui";
    
    private JobParameters      jobParameters;
    private Ui_CreateJobDialog ui;

    public CreateJobDialog(QWidget parent)
    {
        super(parent);
        ui = new Ui_CreateJobDialog();
        ui.setupUi(this);
//        try
//        {
//            QUiLoader.load(new QFile(juiResourceName),this);
//            
//        }
//        catch ( QUiLoaderException e)
//        {
//            e.printStackTrace();
//        }
    }

    public JobParameters getJobParameters()
    {
        return jobParameters;
    }

    public void setJobParameters(JobParameters jobParameters)
    {
        this.jobParameters = jobParameters;
    }

    @Override
    public int exec()
    {
        if (jobParameters == null)
        {
            jobParameters = new JobParameters();
            jobParameters.setName("New");
            jobParameters.setDescription("New");
        }
        return super.exec();
    }

    private void loadSteps()
    {
        ui.jobStepList.clear();
        for (JobStepParameters jobStepParameters : jobParameters.getParameters())
        {
            ui.jobStepList.addItem(jobStepParameters.getName());
        }
    }
    

}
